package model

import "time"

// 购物车表
type ShoppingCart struct {
	BaseModel
	User    int32 `gorm:"type:int;index"`
	Goods   int32 `gorm:"type:int;index"`
	Nums    int32 `gorm:"type:int"`
	Checked bool
}

func (ShoppingCart) TableName() string {
	return "shoppingcart"
}

// 订单表
type OrderInfo struct {
	BaseModel
	User    int32  `gorm:"type:int;index"`
	OrderSn string `gorm:"type:varchar(30);index"`
	PayType string `gorm:"type:varchar(20) comment '支付方式 alipay(支付宝) wechat(微信)'"`

	Status     string     `gorm:"type:varchar(20) comment 'PAYING(待支付) TRADE_SUCCESS(成功) TRADE_CLOSED(超时关闭) WAIT_BUYER_PAY(交易创建) TRADE_FINISHED(交易结束)'"`
	TradeNo    string     `gorm:"type:varchar(100) comment '支付宝交易号或微信订单号'"`
	OrderMount float32    `gorm:"comment '订单金额'"`
	PayTime    *time.Time `gorm:"type:datetime"`

	Address      string `gorm:"type:varchar(100) comment '收货地址'"`
	SignerName   string `gorm:"type:varchar(20) comment '签收人姓名'"`
	SignerMobile string `gorm:"type:varchar(11) comment '签收人手机号'"`
	Post         string `gorm:"type:varchar(20) comment '留言信息'"`
}

func (OrderInfo) TableName() string {
	return "orderinfo"
}

// 订单商品表
type OrderGoods struct {
	BaseModel
	Order int32 `gorm:"type:int;index"`
	Goods int32 `gorm:"type:int;index"`

	GoodsName  string  `gorm:"type:varchar(100);index comment '商品名称'"`
	GoodsImg   string  `gorm:"type:varchar(200) comment '商品图片'"`
	GoodsPrice float32 `gorm:"comment '商品价格'"`
	Nums       int32   `gorm:"type:int comment '商品数量'"`
}

func (OrderGoods) TableName() string {
	return "ordergoods"
}
